/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.coraci.anag.gui.docs.mr;

import it.coraci.anag.db.sql.entities.IDDocType;
import it.coraci.anag.db.sql.entities.Person;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author Luca
 */
public class DocTypeListRenderer extends JLabel implements ListCellRenderer<IDDocType> {

    public DocTypeListRenderer() {
        super();
        this.setOpaque(true);
    }

    @Override
    public Component getListCellRendererComponent(JList<? extends IDDocType> list, IDDocType value, int index, boolean isSelected, boolean cellHasFocus) {
        this.setText(value.getType());
        if (isSelected) {
            this.setBackground(Color.BLUE);
            this.setForeground(Color.YELLOW);
        } else {
            this.setBackground(Color.WHITE);
            this.setForeground(Color.BLACK);
        }
        return this;
    }

}
